<?php

class Skjb_Office_Spreadsheet_Exporter_Excel2007Xml_ApplicationProperties
{
    public function toXml()
    {
        $xml = new XMLWriter();
        $xml->openMemory();
        
        $xml->startDocument('1.0', 'UTF-8', 'yes');
            $xml->startElement('Properties');
                $xml->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties');
                $xml->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
                $xml->writeElement('Application', 'Microsoft Excel');
                $xml->writeElement('DocSecurity', '0');
                $xml->writeElement('ScaleCrop', 'false');
                $xml->startElement('HeadingPairs');
                    $xml->startElement('vt:vector');
                        $xml->writeAttribute('size', '2');
                        $xml->writeAttribute('baseType', 'variant');
                        $xml->startElement('vt:variant');
                            $xml->writeElement('vt:lpstr', 'Worksheets');
                        $xml->endElement(); // vt:variant
                        $xml->startElement('vt:variant');
                            $xml->writeElement('vt:i4', '1');
                        $xml->endElement(); // vt:variant
                    $xml->endElement(); // vt:vector
                $xml->endElement(); // HeadingPairs
                $xml->startElement('TitlesOfParts');
                    $xml->startElement('vt:vector');
                        $xml->writeAttribute('size', '1');
                        $xml->writeAttribute('baseType', 'lpstr');
                        $xml->writeElement('vt:lpstr', 'Sheet1');
                    $xml->endElement(); // vt:vector
                $xml->endElement(); // TitlesOfParts
                $xml->writeElement('LinksUpToDate', 'false');
                $xml->writeElement('SharedDoc', 'false');
                $xml->writeElement('HyperlinksChanged', 'false');
                $xml->writeElement('AppVersion', '12.0000');
            $xml->endElement(); // Properties
        $xml->endDocument();
        
        return $xml->outputMemory();
    }
}
